/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.click.app.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author orgale
 */
@Entity
@Table(name = "distinctiveValues")
@NamedQueries({@NamedQuery(name = "DistinctiveValue.findAll", query = "SELECT d FROM DistinctiveValue d"),
    @NamedQuery(name = "DistinctiveValue.findById", query = "SELECT d FROM DistinctiveValue d WHERE d.id = :idDistinctiveValue"),
    @NamedQuery(name = "DistinctiveValue.findByName", query = "SELECT d FROM DistinctiveValue d WHERE d.name = :name"),
    @NamedQuery(name = "DistinctiveValue.findByValue", query = "SELECT d FROM DistinctiveValue d WHERE d.value = :value")})
public class DistinctiveValue extends BaseObject implements Serializable {

    private static final long serialVersionUID = 1L;
    private Long id;
    private String name;
    private String value;
    private DistinctiveName distinctiveName;

    public DistinctiveValue() {
    }

    public DistinctiveValue(Long id) {
        this.id = id;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(unique = true, name = "id_distinctiveValue")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "value")
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DistinctiveValue)) {
            return false;
        }
        DistinctiveValue other = (DistinctiveValue) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.click.app.model.DistinctiveValue[idDistinctiveValue=" + id + "]";
    }

    /**
     * @return the distinctiveName
     */
    @ManyToOne
    public DistinctiveName getDistinctiveName() {
        return distinctiveName;
    }

    /**
     * @param distinctiveName the distinctiveName to set
     */
    public void setDistinctiveName(DistinctiveName distinctiveName) {
        this.distinctiveName = distinctiveName;
    }
}
